﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ClienteList.aspx.cs" Inherits="Emporium_Web.ClienteList"
    MasterPageFile="~/Menu.Master" Theme="Constellation" %>

<%@ MasterType VirtualPath="~/Menu.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Listado de Clientes</title>
    <script type="text/javascript">
        var hdnSeleccionId = '<%= this.hdnSeleccion.ClientID %>';
    </script>
    <script type="text/javascript" src="js/funciones.grid.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- Content -->
    <article class="container_12">
	  
		<section class="grid_12">
			<div class="block-border">
			<form runat="server" class="block-content form" id="table_form">

				<h1>Listado de Clientes</h1>

                   <div style="width: 100%; padding-top: 20px;">
                    <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                Nombre</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                            <asp:TextBox ID="txtNombre" name="simple-required" runat="server" Width="300px"></asp:TextBox>
                        </div>
                    </div>
                    <div style="width: 100%; height: 45px; float: inherit;">
                        <div style="width: 100px; float: left;">
                            <label>
                                N&uacute;mero</label>
                        </div>
                        <div align="left" style="width: 70%; float: left;">
                            <asp:TextBox ID="txtNumero" name="simple-required" runat="server" Width="100px"></asp:TextBox>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:LinkButton ID="btnBuscar" runat="server" Text="Buscar" CssClass="button red"
                                OnClick="btnBuscar_Click" />
                        </div>
                    </div>
                   </div>

                    <asp:HiddenField ID="hdnSeleccion" runat="server" />
					<ul class="message error no-margin" runat="server" id="errorMessage">
					    <li><asp:Label runat="server" ID="lblErrorMessage"></asp:Label></li>
					</ul>
                    <ul class="message warning no-margin" runat="server"  id="warningMessage">
					    <li><asp:Label runat="server" ID="lblWarningMessage"></asp:Label></li>
					</ul>

                    <div class="block-controls">
                    <emporium:pager ID="gvPager" runat="server" Visible="false" PageSize="5" OnPageChanged="gvPagerPageChanged" />
                    </div>

                    <div class="no-margin">
					<asp:GridView ID="gvClientes" runat="server" SkinID="gridviewSkin" PageSize="5" 
                            Width="100%" onsorting="gvClientes_Sorting" AllowSorting="True" DataKeyNames="Id, Nombre"  
                            onrowcommand="gvClientes_RowCommand">

                            						<Columns>                   
							<asp:TemplateField>
                                <ItemTemplate>
                                      <input id="rbSelect" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:Check('<%# Eval("Id") %>');"/>
								</ItemTemplate>
								<ItemStyle HorizontalAlign="Left" Width="8%" />
							</asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle HorizontalAlign="Left" ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                <span class="column-sort">
									<asp:LinkButton Name="lnkSortUpId" ID="lnkSortUpId" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Id"/>
                                    <asp:LinkButton Name="lnkSortDownId" ID="lnkSortDownId" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Id"/>
								</span>
                                C&oacute;digo
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnConsultar" runat="server" Text='<%# Eval("Id", "{0:00000}")%>' OnClick="btnConsultar_Click"  />
								</ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpNombre" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Nombre"/>
                                        <asp:LinkButton ID="lnkSortDownNombre" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Nombre"/>
								    </span>
                                    Nombre
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Nombre")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpOrigen" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Origen"/>
                                        <asp:LinkButton ID="lnkSortDownOrigen" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Origen"/>
								    </span>
                                    Origen
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Origen")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpNumero" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Numero"/>
                                        <asp:LinkButton ID="lnkSortDownNumero" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Numero"/>
								    </span>
                                    N&uacute;mero
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Numero")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpEmail" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Email"/>
                                        <asp:LinkButton ID="lnkSortDownEmail" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Email"/>
								    </span>
                                    Email
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Email")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpContacto" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Contacto"/>
                                        <asp:LinkButton ID="lnkSortDownContacto" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Contacto"/>
								    </span>
                                    Contacto
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Contacto")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpTelefono" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Telefono"/>
                                        <asp:LinkButton ID="lnkSortDownTelefono" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Telefono"/>
								    </span>
                                    Tel&eacute;fono
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Telefono")%>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpMovil" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Movil"/>
                                        <asp:LinkButton ID="lnkSortDownMovil" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Movil"/>
								    </span>
                                    M&oacute;vil
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Movil")%>
                                </ItemTemplate>
                            </asp:TemplateField>
						</Columns>  

						  
						<PagerSettings Visible="false" />
					</asp:GridView> 
                  </div>
                    <ul class="message no-margin">
                    <li>
                        <asp:Label ID="lblMensajeGridFooter" runat="server"></asp:Label>
                    </li>
				</ul>
					
                <div class="block-footer">
                    <img src="images/icons/fugue/arrow-curve-000-left.png" width="16" height="16" class="picto"> 
                    <asp:LinkButton ID="btnAdicionar" runat="server" Text="Adicionar" CssClass="button" onclick="btnAdicionar_Click" />
				    <asp:LinkButton ID="btnModificar" runat="server" Text="Modificar" CssClass="button" onclick="btnModificar_Click" OnClientClick="return HayUnoSeleccionado();" />
					<asp:LinkButton ID="btnEliminar" runat="server" Text="Eliminar" CssClass="button" onclick="btnEliminar_Click" OnClientClick="return DeleteRegs();" />
                </div>
			</form>
			</div>
		</section>
                
        
	</article>
</asp:Content>
